home *** CD-ROM | disk | FTP | other *** search
- /* INTDOSX.C --- p. 633 */
- #ifdef EXAMPLE_1
- #include <stdio.h>
- #include <dos.h>
- #define DOS_MAKEDIR 0x39
- union REGS xr;
- struct SREGS sr;
- main()
- {
- char pathname[80];
- printf("Enter name of subdirectory: ");
- gets(pathname);
- xr.h.ah = DOS_MAKEDIR;
- sr.ds = FP_SEG(pathname);
- xr.x.dx = FP_OFF(pathname);
- intdosx(&xr, &xr, &sr);
- if (xr.x.cflag == 1)
- printf("\nError creating subdirectory\n");
- }
- #endif
- #include <stdio.h>
- #include <dos.h>
- #define DOS_BUFIN 0x0a
- static char buffer[82] = {80, 0};
- main()
- {
- union REGS xr;
- struct SREGS sr;
- int numchars;
- char far *pbuf;
- pbuf = (char far *)(&buffer[0]);
- printf("Enter a line: ");
- sr.ds = FP_SEG(pbuf);
- xr.h.ah = DOS_BUFIN;
- xr.x.dx = FP_OFF(pbuf);
- intdosx(&xr, &xr, &sr);
- /* The number of characters not counting the carriage
- * return */
- numchars = buffer[1];
- /* Make it an ASCIIZ string by adding a 0 at the end*/
- buffer[numchars+2] = '\0';
- printf("\nYou typed %d characters\n", numchars);
- printf("The string is: %s", buffer+2);
- }